<!--#include file="conn.asp"-->
<!--#include file="chkuser.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<%Server.ScriptTimeOut=5000%>
<style type="text/css">
*{ padding:0px; margin:0px; font-size:12px}
a{ color:#666666;}
a:hover{ color:#000000}
</style>
<!--#include FILE="upload_5xsoft.asp"-->
<%
f="./../UpLoadFiles/" '图片存放文件夹路径
n=request.QueryString("n")
m=request("m")
if m="ok" then
	set upload=new upload_5xsoft
	set file=upload.file("file1")
	formPath=f
	if file.fileSize>0 then
		strFileType = lcase(mid(file.filename,instrrev(file.filename,".")))  
		randomize
		ranNum=int(900*rnd)+100
		strFileName=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum
		
			arrUpFileType=split(UpFileType_con,"|")
			EnableUpload=false
			for i=0 to ubound(arrUpFileType)
				if strFileType="."&trim(arrUpFileType(i)) then
					EnableUpload=true
					exit for
				end if
			next
	
		if EnableUpload=false then
			response.write "Error：文件格式不正确！　[ <a href='javascript:history.go(-1);'>返回</a> ]"
			response.end
		elseif file.fileSize>MaxUpFileSize_con*1024 then
			response.Write("Error：只能上传大小 " & CStr(MaxUpFileSize_con) & "kb 以内的文件！<a href='javascript:history.go(-1);'>返回</a>")
		else
			'创建文件夹
			ymd = year(now) & month(now) & day(now)
			formPath = formPath & ymd & "/"
			Set fso = Server.CreateObject("Scripting.FileSystemObject")
			If Not fso.FolderExists(Server.mappath(formPath)) Then
				fso.CreateFolder(Server.mappath(formPath))
			End If
			Set fso=nothing
			file.saveAs Server.mappath(formPath&strFileName&strFileType)
			strJS="<script>"
			strJS=strJS&"parent.document.all."&n&".value='"&replace(formPath,"./../","")&strFileName&strFileType&"';"
			strJS=strJS&"</script>"
			strJS=strJS&"<input value='"&replace(formPath,"./../","")&strFileName&strFileType&"' name='text' type='hidden'>"
			strJS=strJS&"上传成功<a href='#' onclick="&chr(34)&"window.clipboardData.setData('text',text.value);alert('复制成功');"&chr(34)&">[复制地址]</a>&nbsp;<a href='?n="&n&"'>[重新上传]</a>"
			response.Write strJS
		end if
	else
		response.Write "请先选择你要上传的文件&nbsp;&nbsp;<a href='?n="&n&"'>[返回]</a>"
	end if
	set file=nothing
	set upload=nothing
else
	if EnableUploadFile_con=True then
		if session("SYSUser")<>"" then
	%>
	<form name="form1" method="post" action="?m=ok&n=<%=n%>" enctype="multipart/form-data" style="margin:0px; margin:0px;" >
	<input type="file" name="file1" style="width:200px" class="tx1" value=""><input name="" type="submit" value="上传" />
	</form>
	
	<%
		else
		response.Write("对不起，请先登入！")
		end if
	else
	  response.Write("上传功能已关闭，请先开启！")
	end if
end if
%>